package cn.touna.jss.modules.third.tx.enums;

import java.util.*;

public enum TianXingScoreEnum {

    /************天行分数映射返回码*************/
    wu("0",0, "无不良信息"),
    xidu("1",1, "吸毒"),
    shedu("2",2, "涉毒"),
    shedu3("3",3, "吸毒+涉毒"),
    qianke("4",4, "前科"),
    qianke1("5",5, "吸毒+前科"),
    qianke2("6",6, "涉毒+前科"),
    qianke3("7",7, "吸毒+涉毒+前科"),
    qianke4("8",8, "在逃"),
    qianke5("9",9, "在逃+吸毒"),
    qianke6("10",10, "涉毒+在逃"),
    qianke7("11",11, "吸毒+涉毒+在逃"),
    qianke8("12",12, "前科+在逃"),
    qianke9("13",13, "吸毒+前科+在逃"),
    qianke10("14",14, "涉毒+前科+在逃"),
    zaitao("15",15, "吸毒+涉毒+前科+在逃");
    /**
     * 枚举值
     */
    private final String value;
    private final int  score;


    /**
     * 枚举文本
     */
    private final String text;

    TianXingScoreEnum(String value,int  score, String text) {
        this.value = value;
        this.score = score;
        this.text = text;
    }

    /**
     * {@inheritDoc}
     */
    public String value() {
        return value;
    }

    /**
     * 获取枚举对象文本
     *
     * @return String
     */
    public String text() {
        return text;
    }

    /**
     * 根据值获取枚举对象
     *
     * @param value 枚举值
     * @return 对象枚举对象
     */
    public static TianXingScoreEnum getEnum(String value) {
        for (TianXingScoreEnum status : values()) {
            if (status.value().equals(value)) {
                return status;
            }
        }
        return null;
    }

    /**
     * 通过天行不良信息分，得出组合信息
     * @param value
     * @return
     */
    public  static  String getScoreMsg(String value){
        String msg="";
        TianXingScoreEnum emnu = getEnum(value);
        if(emnu!=null){
            return emnu.text;
        }
        return msg;
    }





    /**
     * 根据code获取值
     *
     * @param code 枚举值
     * @return 对象枚举对象
     */
    public static String getValue(String code) {
        for (TianXingScoreEnum status : values()) {
            if (status.value().equals(code)) {
                return status.text();
            }
        }
        return "";
    }


    /**
     * ENUM 转换成MAP
     */
    private static final Map<String, String> riskStatusMap = new HashMap<String, String>();
    static List<Integer> list = new ArrayList<>();

    static {
        for (TianXingScoreEnum it : EnumSet.allOf(TianXingScoreEnum.class)) {
            riskStatusMap.put(it.value(), it.text());
        }
    }


    public static void main(String[] args) {
        System.out.println(list);

    }


}
